<?php

class User_Controller_Admincp_Manage_Delete extends Nuo_Controller_Admincp
{
	function execute($request)
	{

		$id = $request -> getParam('user_id');
		$table = Nuo::getTable('user');
		$form = Nuo::getObject('user/admincp/manage/delete', 'form');
		$item = NULL;

		$form -> setTitle('Delete Member');
		$form -> setDesc('Do you want to delete selected members');
		$form -> isAsync();

		if ($id)
		{
			$item = $table -> find($id) -> current();
		}

		if ($request -> isGet() && $item)
		{
			$form -> setData($item -> toArray());
		}

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$item -> delete();
			echo 'nuo.fboxClose();nuo.refresh();';
			return;
			//Nuo_Messenger::instance()->add(Intl::__('Updated!'));
		}

		return  Nuo::getView()->render('core/view/controller/admincp/edit', array('form' => $form));
	}

}
